

#import "FAMHomeTimerView.h"
@interface FAMHomeTimerView()
@property (weak, nonatomic) IBOutlet UIDatePicker *FAMDatePicker;
@property (nonatomic, strong)NSDate *FAMDate;
@end
@implementation FAMHomeTimerView

- (instancetype)initWithFrame:(CGRect)frame{
    self = [super initWithFrame:frame];
    if (self) {
        NSArray *array = [[NSBundle mainBundle] loadNibNamed:@"FAMHomeTimerView" owner:self options:nil];
        self = array.firstObject;
        self.FAMDatePicker.maximumDate = [NSDate date];
        self.FAMDate = [NSDate date];
        [FAMUserManger shareInstance].FAMTimer = [FAMTool FAM_getYearWithMonthWithDay];
    }
    return self;
}
- (void)layoutSubviews{
    [super layoutSubviews];
    self.frame = CGRectMake(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT);
}
- (IBAction)FAM_datePickerValueChangedClick:(UIDatePicker *)sender {
    self.FAMDate = sender.date;
}

- (IBAction)FAM_confimButtonClick:(UIButton *)sender {
    [FAMUserManger shareInstance].FAMTimer = [FAMTool FAM_getYearWithMonthWithDay:self.FAMDate];
    if (self.block) {
        self.block(self.FAMDate);
    }
    [UIWindow.currentViewController performSelector:@selector(FAM_loadData:isFirst:) withObject:[FAMTool FAM_getYearWithMonthWithDay:self.FAMDate] withObject:@(YES)];
    [self removeFromSuperview];
}

@end
